<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>UDisksSpawnedJob: UDisks Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="UDisks Reference Manual">
<link rel="up" href="ref-daemon-jobs.html" title="Jobs">
<link rel="prev" href="UDisksThreadedJob.html" title="UDisksThreadedJob">
<link rel="next" href="ref-daemon-linux-types.html" title="Linux-specific types">
<meta name="generator" content="GTK-Doc V1.29 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#UDisksSpawnedJob.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
                  <a href="#UDisksSpawnedJob.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
                  <a href="#UDisksSpawnedJob.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span><span id="nav_properties">  <span class="dim">|</span> 
                  <a href="#UDisksSpawnedJob.properties" class="shortcut">Properties</a></span><span id="nav_signals">  <span class="dim">|</span> 
                  <a href="#UDisksSpawnedJob.signals" class="shortcut">Signals</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ref-daemon-jobs.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="UDisksThreadedJob.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="ref-daemon-linux-types.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="UDisksSpawnedJob"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="UDisksSpawnedJob.top_of_page"></a>UDisksSpawnedJob</span></h2>
<p>UDisksSpawnedJob — Job that spawns a command</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="UDisksSpawnedJob.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="UDisksSpawnedJob.html" title="UDisksSpawnedJob"><span class="returnvalue">UDisksSpawnedJob</span></a> *
</td>
<td class="function_name">
<a class="link" href="UDisksSpawnedJob.html#udisks-spawned-job-new" title="udisks_spawned_job_new ()">udisks_spawned_job_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="UDisksSpawnedJob.html#udisks-spawned-job-get-command-line" title="udisks_spawned_job_get_command_line ()">udisks_spawned_job_get_command_line</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UDisksSpawnedJob.html#udisks-spawned-job-start" title="udisks_spawned_job_start ()">udisks_spawned_job_start</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="UDisksSpawnedJob.properties"></a><h2>Properties</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="properties_type">
<col width="300px" class="properties_name">
<col width="200px" class="properties_flags">
</colgroup>
<tbody>
<tr>
<td class="property_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</td>
<td class="property_name"><a class="link" href="UDisksSpawnedJob.html#UDisksSpawnedJob--command-line" title="The “command-line” property">command-line</a></td>
<td class="property_flags">Read / Write / Construct Only</td>
</tr>
<tr>
<td class="property_type">
<span class="type">AutowipeBuffer</span> *</td>
<td class="property_name"><a class="link" href="UDisksSpawnedJob.html#UDisksSpawnedJob--input-string" title="The “input-string” property">input-string</a></td>
<td class="property_flags">Write / Construct Only</td>
</tr>
<tr>
<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
<td class="property_name"><a class="link" href="UDisksSpawnedJob.html#UDisksSpawnedJob--run-as-euid" title="The “run-as-euid” property">run-as-euid</a></td>
<td class="property_flags">Write / Construct Only</td>
</tr>
<tr>
<td class="property_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></td>
<td class="property_name"><a class="link" href="UDisksSpawnedJob.html#UDisksSpawnedJob--run-as-uid" title="The “run-as-uid” property">run-as-uid</a></td>
<td class="property_flags">Write / Construct Only</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="UDisksSpawnedJob.signals"></a><h2>Signals</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="signals_return">
<col width="300px" class="signals_name">
<col width="200px" class="signals_flags">
</colgroup>
<tbody><tr>
<td class="signal_type"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a></td>
<td class="signal_name"><a class="link" href="UDisksSpawnedJob.html#UDisksSpawnedJob-spawned-job-completed" title="The “spawned-job-completed” signal">spawned-job-completed</a></td>
<td class="signal_flags"><a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="UDisksSpawnedJob.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody><tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="UDisksSpawnedJob.html#UDisksSpawnedJob-struct" title="UDisksSpawnedJob">UDisksSpawnedJob</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="UDisksSpawnedJob.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen">    <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
    <span class="lineart">╰──</span> <a href="https://developer.gnome.org/gio/unstable/GDBusInterfaceSkeleton.html#GDBusInterfaceSkeleton-struct">GDBusInterfaceSkeleton</a>
        <span class="lineart">╰──</span> <a class="link" href="UDisksJob.html#UDisksJobSkeleton">UDisksJobSkeleton</a>
            <span class="lineart">╰──</span> <a class="link" href="UDisksBaseJob.html" title="UDisksBaseJob">UDisksBaseJob</a>
                <span class="lineart">╰──</span> UDisksSpawnedJob
</pre>
</div>
<div class="refsect1">
<a name="UDisksSpawnedJob.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
UDisksSpawnedJob implements
 <a href="https://developer.gnome.org/gio/unstable/GDBusInterface.html#GDBusInterface-struct">GDBusInterface</a> and  <a class="link" href="UDisksJob.html" title="UDisksJob">UDisksJob</a>.</p>
</div>
<div class="refsect1">
<a name="UDisksSpawnedJob.description"></a><h2>Description</h2>
<p>This type provides an implementation of the <a class="link" href="UDisksJob.html" title="UDisksJob"><span class="type">UDisksJob</span></a> interface
for jobs that are implemented by spawning a command line.</p>
</div>
<div class="refsect1">
<a name="UDisksSpawnedJob.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="udisks-spawned-job-new"></a><h3>udisks_spawned_job_new ()</h3>
<pre class="programlisting"><a class="link" href="UDisksSpawnedJob.html" title="UDisksSpawnedJob"><span class="returnvalue">UDisksSpawnedJob</span></a> *
udisks_spawned_job_new (<em class="parameter"><code>const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *command_line</code></em>,
                        <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Strings.html#GString"><span class="type">GString</span></a> *input_string</code></em>,
                        <em class="parameter"><code><span class="type">uid_t</span> run_as_uid</code></em>,
                        <em class="parameter"><code><span class="type">uid_t</span> run_as_euid</code></em>,
                        <em class="parameter"><code><a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a> *daemon</code></em>,
                        <em class="parameter"><code><a href="https://developer.gnome.org/gio/unstable/GCancellable.html#GCancellable-struct"><span class="type">GCancellable</span></a> *cancellable</code></em>);</pre>
<p>Creates a new <a class="link" href="UDisksSpawnedJob.html" title="UDisksSpawnedJob"><span class="type">UDisksSpawnedJob</span></a> instance.</p>
<p>The job is not started automatically! Use <a class="link" href="UDisksSpawnedJob.html#udisks-spawned-job-start" title="udisks_spawned_job_start ()"><code class="function">udisks_spawned_job_start()</code></a> to start
the job after <a class="link" href="UDisksSpawnedJob.html#UDisksSpawnedJob-spawned-job-completed" title="The “spawned-job-completed” signal"><span class="type">“spawned-job-completed”</span></a> or
<a class="link" href="UDisksJob.html#UDisksJob-completed" title="The “completed” signal"><span class="type">“completed”</span></a> signals are connected (to get notified when the job is
done). This is to prevent a race condition with the spawned process
terminating before the signals are connected in which case the signal
handlers are never triggered.</p>
<div class="refsect3">
<a name="udisks-spawned-job-new.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>command_line</p></td>
<td class="parameter_description"><p>The command line to run.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>input_string</p></td>
<td class="parameter_description"><p>A string to write to stdin of the spawned program or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>run_as_uid</p></td>
<td class="parameter_description"><p>The <span class="type">uid_t</span> to run the program as.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>run_as_euid</p></td>
<td class="parameter_description"><p>The effective <span class="type">uid_t</span> to run the program as.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>daemon</p></td>
<td class="parameter_description"><p>A <a class="link" href="UDisksDaemon.html" title="UDisksDaemon"><span class="type">UDisksDaemon</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p>A <a href="https://developer.gnome.org/gio/unstable/GCancellable.html#GCancellable-struct"><span class="type">GCancellable</span></a> or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-spawned-job-new.returns"></a><h4>Returns</h4>
<p> A new <a class="link" href="UDisksSpawnedJob.html" title="UDisksSpawnedJob"><span class="type">UDisksSpawnedJob</span></a>. Free with <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-spawned-job-get-command-line"></a><h3>udisks_spawned_job_get_command_line ()</h3>
<pre class="programlisting">const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
udisks_spawned_job_get_command_line (<em class="parameter"><code><a class="link" href="UDisksSpawnedJob.html" title="UDisksSpawnedJob"><span class="type">UDisksSpawnedJob</span></a> *job</code></em>);</pre>
<p>Gets the command line that <em class="parameter"><code>job</code></em>
 was constructed with.</p>
<div class="refsect3">
<a name="udisks-spawned-job-get-command-line.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>job</p></td>
<td class="parameter_description"><p>A <a class="link" href="UDisksSpawnedJob.html" title="UDisksSpawnedJob"><span class="type">UDisksSpawnedJob</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="udisks-spawned-job-get-command-line.returns"></a><h4>Returns</h4>
<p> A string owned by <em class="parameter"><code>job</code></em>
. Do not free.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="udisks-spawned-job-start"></a><h3>udisks_spawned_job_start ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
udisks_spawned_job_start (<em class="parameter"><code><a class="link" href="UDisksSpawnedJob.html" title="UDisksSpawnedJob"><span class="type">UDisksSpawnedJob</span></a> *job</code></em>);</pre>
<p>Connect to the <a class="link" href="UDisksSpawnedJob.html#UDisksSpawnedJob-spawned-job-completed" title="The “spawned-job-completed” signal"><span class="type">“spawned-job-completed”</span></a> or
<a class="link" href="UDisksJob.html#UDisksJob-completed" title="The “completed” signal"><span class="type">“completed”</span></a> signals to get notified when the job is done.</p>
<p>*/
void udisks_spawned_job_start (UDisksSpawnedJob *job)
{
  GError *error;
  gint child_argc;
  gchar **child_argv = NULL;
  struct passwd pwstruct;
  gchar pwbuf[8192];
  struct passwd *pw = NULL;
  int rc;</p>
<p>  job-&gt;main_context = <a href="https://developer.gnome.org/glib/unstable/glib-The-Main-Event-Loop.html#g-main-context-get-thread-default"><code class="function">g_main_context_get_thread_default()</code></a>;
  if (job-&gt;main_context != NULL)
    g_main_context_ref (job-&gt;main_context);</p>
<p>  /* could already be cancelled */
  error = NULL;
  if (g_cancellable_set_error_if_cancelled (udisks_base_job_get_cancellable (UDISKS_BASE_JOB (job)), &amp;error))
    {
      emit_completed_with_error_in_idle (job, error);
      g_clear_error (&amp;error);
      goto out;
    }</p>
<p>  job-&gt;cancellable_handler_id = g_cancellable_connect (udisks_base_job_get_cancellable (UDISKS_BASE_JOB (job)),
                                                       G_CALLBACK (on_cancelled),
                                                       job,
                                                       NULL);</p>
<p>  error = NULL;
  if (!g_shell_parse_argv (job-&gt;command_line,
                           &amp;child_argc,
                           &amp;child_argv,
                           &amp;error))
    {
      g_prefix_error (&amp;error,
                      "Error parsing command-line `<code class="literal">s</code>': ",
                      job-&gt;command_line);
      emit_completed_with_error_in_idle (job, error);
      g_clear_error (&amp;error);
      goto out;
    }</p>
<p>  /* Save real egid and gid info for the child process */
  if (job-&gt;run_as_uid != <code class="function">getuid()</code> || job-&gt;run_as_euid != <code class="function">geteuid()</code>)
    {
      rc = getpwuid_r (job-&gt;run_as_euid, &amp;pwstruct, pwbuf, sizeof pwbuf, &amp;pw);
      if (rc != 0 || pw == NULL)
        {
          g_set_error(&amp;error, G_IO_ERROR, G_IO_ERROR_FAILED,
                      "No password record for uid <code class="literal">d</code>: <code class="literal">m</code>\n", (gint) job-&gt;run_as_euid);
          emit_completed_with_error_in_idle (job, error);
          g_clear_error (&amp;error);
          goto out;
        }
      job-&gt;real_egid = pw-&gt;pw_gid;</p>
<p>      rc = getpwuid_r (job-&gt;run_as_uid, &amp;pwstruct, pwbuf, sizeof pwbuf, &amp;pw);
      if (rc != 0 || pw == NULL)
        {
          g_set_error(&amp;error, G_IO_ERROR, G_IO_ERROR_FAILED,
                      "No password record for uid <code class="literal">d</code>: <code class="literal">m</code>\n", (gint) job-&gt;run_as_uid);
          emit_completed_with_error_in_idle (job, error);
          g_clear_error (&amp;error);
          goto out;
        }
      job-&gt;real_gid = pw-&gt;pw_gid;
      job-&gt;real_uid = pw-&gt;pw_uid;
      job-&gt;real_pwname = strdup (pw-&gt;pw_name);
    }</p>
<p>  error = NULL;
  if (!g_spawn_async_with_pipes (NULL, /* working directory */
                                 child_argv,
                                 NULL, /* envp */
                                 G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
                                 child_setup, /* child_setup */
                                 job, /* child_setup's user_data */
                                 &amp;(job-&gt;child_pid),
                                 job-&gt;input_string != NULL ? &amp;(job-&gt;child_stdin_fd) : NULL,
                                 &amp;(job-&gt;child_stdout_fd),
                                 &amp;(job-&gt;child_stderr_fd),
                                 &amp;error))
    {
      g_prefix_error (&amp;error,
                      "Error spawning command-line `<code class="literal">s</code>': ",
                      job-&gt;command_line);
      emit_completed_with_error_in_idle (job, error);
      g_clear_error (&amp;error);
      goto out;
    }</p>
<p>  job-&gt;child_watch_source = g_child_watch_source_new (job-&gt;child_pid);
#if __GNUC__ &gt;= 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
/* parameters of the callback depend on the source and can be different
from the required "generic" GSourceFunc, see:
https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html<a href="https://developer.gnome.org/glib/unstable/glib-The-Main-Event-Loop.html#g-source-set-callback"><span class="type">g-source-set-callback</span></a></p>
<div class="refsect3">
<a name="udisks-spawned-job-start.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>job</p></td>
<td class="parameter_description"><p>the job to start</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
</div>
<div class="refsect1">
<a name="UDisksSpawnedJob.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="UDisksSpawnedJob-struct"></a><h3>UDisksSpawnedJob</h3>
<pre class="programlisting">typedef struct _UDisksSpawnedJob UDisksSpawnedJob;</pre>
<p>The <a class="link" href="UDisksSpawnedJob.html" title="UDisksSpawnedJob"><span class="type">UDisksSpawnedJob</span></a> structure contains only private data and should
only be accessed using the provided API.</p>
</div>
</div>
<div class="refsect1">
<a name="UDisksSpawnedJob.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="UDisksSpawnedJob--command-line"></a><h3>The <code class="literal">“command-line”</code> property</h3>
<pre class="programlisting">  “command-line”             <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *</pre>
<p>The command-line to run.</p>
<p>Flags: Read / Write / Construct Only</p>
<p>Default value: NULL</p>
</div>
<hr>
<div class="refsect2">
<a name="UDisksSpawnedJob--input-string"></a><h3>The <code class="literal">“input-string”</code> property</h3>
<pre class="programlisting">  “input-string”             <span class="type">AutowipeBuffer</span> *</pre>
<p>String that will be written to stdin of the spawned program or
<a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to not write anything.</p>
<p>This is passed as autowipe_buffer (rather than G_TYPE_GSTRING) to nuke
the contents after usage since the input string may contain key material.</p>
<p>Flags: Write / Construct Only</p>
</div>
<hr>
<div class="refsect2">
<a name="UDisksSpawnedJob--run-as-euid"></a><h3>The <code class="literal">“run-as-euid”</code> property</h3>
<pre class="programlisting">  “run-as-euid”              <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
<p>The effective <span class="type">uid_t</span> to run the program as.</p>
<p>Flags: Write / Construct Only</p>
<p>Default value: 0</p>
</div>
<hr>
<div class="refsect2">
<a name="UDisksSpawnedJob--run-as-uid"></a><h3>The <code class="literal">“run-as-uid”</code> property</h3>
<pre class="programlisting">  “run-as-uid”               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a></pre>
<p>The <span class="type">uid_t</span> to run the program as.</p>
<p>Flags: Write / Construct Only</p>
<p>Default value: 0</p>
</div>
</div>
<div class="refsect1">
<a name="UDisksSpawnedJob.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2">
<a name="UDisksSpawnedJob-spawned-job-completed"></a><h3>The <code class="literal">“spawned-job-completed”</code> signal</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
user_function (<a class="link" href="UDisksSpawnedJob.html" title="UDisksSpawnedJob"><span class="type">UDisksSpawnedJob</span></a> *job,
               <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>           *error,
               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a>              status,
               <a href="https://developer.gnome.org/glib/unstable/glib-Strings.html#GString"><span class="type">GString</span></a>          *standard_output,
               <a href="https://developer.gnome.org/glib/unstable/glib-Strings.html#GString"><span class="type">GString</span></a>          *standard_error,
               <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>          user_data)</pre>
<p>Emitted when the spawned job is complete. If spawning the command
failed or if the job was cancelled, <em class="parameter"><code>error</code></em>
 will
non-<a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. Otherwise you can use macros such as <code class="function">WIFEXITED()</code> and
<code class="function">WEXITSTATUS()</code> on the <em class="parameter"><code>status</code></em>
 integer to obtain more information.</p>
<p>The default implementation simply emits the <a class="link" href="UDisksJob.html#UDisksJob-completed" title="The “completed” signal"><span class="type">“completed”</span></a>
signal with <em class="parameter"><code>success</code></em>
 set to <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if, and only if, <em class="parameter"><code>error</code></em>
 is
<a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, <code class="function">WIFEXITED()</code> evaluates to <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> and <code class="function">WEXITSTATUS()</code> is
zero. Additionally, <em class="parameter"><code>message</code></em>
 on that signal is set to
<em class="parameter"><code>standard_error</code></em>
 regards of whether <em class="parameter"><code>success</code></em>
 is <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>.</p>
<p>You can avoid the default implementation by returning <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> from
your signal handler.</p>
<p>This signal is emitted in the</p>
<a href="https://developer.gnome.org/glib/unstable/glib-The-Main-Event-Loop.html#g-main-context-push-thread-default">thread-default main loop</a><p>of the thread that <em class="parameter"><code>job</code></em>
 was created in.</p>
<div class="refsect3">
<a name="UDisksSpawnedJob-spawned-job-completed.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>job</p></td>
<td class="parameter_description"><p>The <a class="link" href="UDisksSpawnedJob.html" title="UDisksSpawnedJob"><span class="type">UDisksSpawnedJob</span></a> emitting the signal.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p><a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if running the whole command line succeeded, otherwise a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> that is set.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>status</p></td>
<td class="parameter_description"><p>The exit status of the command line that was run.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>standard_output</p></td>
<td class="parameter_description"><p>Standard output from the command line that was run.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>standard_error</p></td>
<td class="parameter_description"><p>Standard error output from the command line that was run.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="UDisksSpawnedJob-spawned-job-completed.returns"></a><h4>Returns</h4>
<p> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the signal was handled, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> to let other
handlers run.</p>
</div>
<p>Flags: <a href="https://developer.gnome.org/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS">Run Last</a></p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.29</div>
</body>
</html>